package framework.mvc;

import framework.account.IAccount;

public class DebtButton extends ACustomButton {

    public DebtButton(AFincoView view, String buttonValue) {
        super(view, buttonValue);
    }

    @Override
    public void fireClick() {
        // get selected name
        int rowSelectedIndex = view.getRowSelectedIndex();
        if (rowSelectedIndex == -1)
            return;
        view.setSelectedRowIndex(rowSelectedIndex);

        IAccount account = FincoContext.getFinco().getSelectedAccount(rowSelectedIndex);
        DebtDialog depositDialog = new DebtDialog(view, actionName, account);
        depositDialog.setBounds(450, 20, 300, 380);
        depositDialog.setVisible(true);
        FincoContext.getFinco().refresh();
    }
}
